Skip to content

feat: add injectable interceptor targets for trading-screen plugins#20

Open
cryptobardx wants to merge 4 commits into
OrderlyNetwork:mainfrom
cryptobardx:feat/trading-interceptor-targets
Open

feat: add injectable interceptor targets for trading-screen plugins#20
cryptobardx wants to merge 4 commits into
OrderlyNetwork:mainfrom
cryptobardx:feat/trading-interceptor-targets

Conversation

@cryptobardx

@cryptobardx cryptobardx commented May 29, 2026

Copy link
Copy Markdown

We've been building a grid-bot plugin on top of the SDK and ran into a few spots on the trading screen that aren't interceptable yet. This adds them as injectable targets so a plugin can extend order entry, the chart, and the data list without forking.

It's all additive. Each target wraps existing UI and falls back to the original (or renders nothing) when nothing intercepts it, so default behavior doesn't change.

What's added:

  • Trading.OrderEntry.AdvancedSelect: add an item to the order-type Advanced dropdown (same items-prop shape as TradingView.DisplayControl.DesktopMenuList). A selected value that isn't a real OrderType gets routed through onExtraSelect and tracked as selectedExtraId.
  • Trading.OrderEntry.Body: replace the form body (e.g. a custom deploy form) while the type selector stays in place.
  • Trading.OrderEntry.BuySellSwitch: now takes selectedCustomTypeId so a plugin can hide Buy/Sell for its own type only.
  • Trading.Chart.Overlay: renders over the chart once the widget is ready, and gets the live IChartingLibraryWidget and current symbol (exposed via a readyWidget state set in onChartReady).
  • Trading.DataList.Desktop.Tabs: append tabs to the desktop data list.

Worth calling out: four of these are plain wrappers, but the order-type one is a bit more involved. orderTypeSelect and orderEntry.ui now track selectedExtraId so a non-OrderType selection can drive the body and the side switch. I left InjectableOrderEntry and the widget alone, but if you'd rather have a proper custom-order-type registration API instead of this routing, I'm happy to redo it that way.

Desktop only for now. The mobile layout doesn't have equivalents yet, so mobile will come as a separate PR.

How I tested it: built the workspace and drove all five from a small throwaway plugin on the storybook trading page. The custom type shows in the dropdown; selecting it swaps the body and hides Buy/Sell; the chart overlay draws with the live widget and follows symbol changes; and a custom tab shows in the data list. Nothing changes when no plugin is registered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant